package cliente.gui;

import java.awt.event.ActionListener;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;

import javax.swing.JFrame;
import javax.swing.table.DefaultTableModel;

import servidor.dominio.*;
import servidor.dominio.Concepto;
import servidor.dominio.Empleado;

import comun.dto.*;


/**
 *
 * @author German
 */
public class GUIModificacionEmpleado extends JFrame {

    /** Creates new form GUIModificacionEmpleado */
    public GUIModificacionEmpleado() {
        initComponents();
        this.setLocationRelativeTo(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        datos = new javax.swing.JTabbedPane();
        datosPersonlaes = new javax.swing.JTabbedPane();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        aceptar = new javax.swing.JButton();
        cancelar = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        nombre = new javax.swing.JTextField();
        apellido = new javax.swing.JTextField();
        cuil = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        cuitEmpresa = new javax.swing.JTextField();
        calendario = new org.freixas.jcalendar.JCalendarCombo();
        categoria = new javax.swing.JComboBox();
        conceptos = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tablaConceptos = new javax.swing.JTable();
        conbConceptos = new javax.swing.JComboBox();
        agregarConcepto = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        nroDeCuenta = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        nroSucursal = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        banco = new javax.swing.JTextField();
        eliminar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        aceptar.setText("Acpetar");
        aceptar.setBounds(110, 260, 80, 23);
        jLayeredPane1.add(aceptar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        cancelar.setText("Cancelar");
        cancelar.setBounds(210, 260, 90, 23);
        jLayeredPane1.add(cancelar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel1.setText("Nombre: ");
        jLabel1.setBounds(10, 30, 70, 14);
        jLayeredPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setText("Apellido: ");
        jLabel2.setBounds(10, 60, 70, 14);
        jLayeredPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel3.setText("Cuil:");
        jLabel3.setBounds(10, 90, 40, 14);
        jLayeredPane1.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel4.setText("Fecha de Ingreso: ");
        jLabel4.setBounds(10, 170, 110, 14);
        jLayeredPane1.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel5.setText("Categoria:");
        jLabel5.setBounds(10, 210, 60, 14);
        jLayeredPane1.add(jLabel5, javax.swing.JLayeredPane.DEFAULT_LAYER);
        nombre.setBounds(60, 30, 250, 20);
        jLayeredPane1.add(nombre, javax.swing.JLayeredPane.DEFAULT_LAYER);
        apellido.setBounds(60, 60, 250, 20);
        jLayeredPane1.add(apellido, javax.swing.JLayeredPane.DEFAULT_LAYER);
        cuil.setBounds(60, 90, 250, 20);
        jLayeredPane1.add(cuil, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel6.setText("Cuit Empresa que Pertenece:");
        jLabel6.setBounds(10, 130, 170, 14);
        jLayeredPane1.add(jLabel6, javax.swing.JLayeredPane.DEFAULT_LAYER);
        cuitEmpresa.setBounds(180, 130, 130, 20);
        jLayeredPane1.add(cuitEmpresa, javax.swing.JLayeredPane.DEFAULT_LAYER);
        calendario.setBounds(110, 170, 200, 20);
        jLayeredPane1.add(calendario, javax.swing.JLayeredPane.DEFAULT_LAYER);

        categoria.setMaximumRowCount(100);
        categoria.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));
        categoria.setSelectedIndex(-1);
        categoria.setBounds(110, 210, 200, 20);
        jLayeredPane1.add(categoria, javax.swing.JLayeredPane.DEFAULT_LAYER);

        datosPersonlaes.addTab("Empleado", jLayeredPane1);

        datos.addTab("Datos Personales", datosPersonlaes);

        jLabel7.setText("Seleccione los conceptos: ");

        tablaConceptos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Descripcion", "Importe", "Porcentaje", "Remunerativo", "Tipo"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tablaConceptos);

        conbConceptos.setMaximumRowCount(100);
        conbConceptos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                conbConceptosActionPerformed(evt);
            }
        });

        agregarConcepto.setText("Agregar");

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Bancarios"));

        jLabel8.setText("Nro de Cuenta:");

        nroDeCuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nroDeCuentaActionPerformed(evt);
            }
        });

        jLabel9.setText("Nro de Sucursal: ");

        jLabel10.setText("Banco:");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(nroSucursal, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(nroDeCuenta, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE))
                    .addComponent(banco, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(104, 104, 104))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(nroDeCuenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9)
                    .addComponent(nroSucursal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10)
                    .addComponent(banco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        eliminar.setText("Eliminar");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(eliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(agregarConcepto, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(conbConceptos, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE))))
                .addContainerGap(21, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10, 10, 10))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(conbConceptos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(agregarConcepto)
                    .addComponent(eliminar))
                .addGap(19, 19, 19)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        conceptos.addTab("Conceptos", jPanel1);

        datos.addTab("Conceptos", conceptos);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 442, Short.MAX_VALUE)
            .addComponent(datos, javax.swing.GroupLayout.PREFERRED_SIZE, 442, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 361, Short.MAX_VALUE)
            .addComponent(datos, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>

private void conbConceptosActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}

private void nroDeCuentaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(GUIModificacionEmpleado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(GUIModificacionEmpleado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(GUIModificacionEmpleado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(GUIModificacionEmpleado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new GUIModificacionEmpleado().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify
    private javax.swing.JButton aceptar;
    private javax.swing.JButton agregarConcepto;
    private javax.swing.JTextField apellido;
    private javax.swing.JTextField banco;
    private org.freixas.jcalendar.JCalendarCombo calendario;
    private javax.swing.JButton cancelar;
    private javax.swing.JComboBox categoria;
    private javax.swing.JComboBox conbConceptos;
    private javax.swing.JTabbedPane conceptos;
    private javax.swing.JTextField cuil;
    private javax.swing.JTextField cuitEmpresa;
    private javax.swing.JTabbedPane datos;
    private javax.swing.JTabbedPane datosPersonlaes;
    private javax.swing.JButton eliminar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField nombre;
    private javax.swing.JTextField nroDeCuenta;
    private javax.swing.JTextField nroSucursal;
    private javax.swing.JTable tablaConceptos;
    // End of variables declaration

    /**
     * @return the aceptar
     */
    public javax.swing.JButton getAceptar() {
        return aceptar;
    }

    /**
     * @param aceptar the aceptar to set
     */
    public void setAceptar(javax.swing.JButton aceptar) {
        this.aceptar = aceptar;
    }

    /**
     * @return the agregarConcepto
     */
    public javax.swing.JButton getAgregarConcepto() {
        return agregarConcepto;
    }

    /**
     * @param agregarConcepto the agregarConcepto to set
     */
    public void setAgregarConcepto(javax.swing.JButton agregarConcepto) {
        this.agregarConcepto = agregarConcepto;
    }

    /**
     * @return the apellido
     */
    public javax.swing.JTextField getApellido() {
        return apellido;
    }

    /**
     * @param apellido the apellido to set
     */
    public void setApellido(javax.swing.JTextField apellido) {
        this.apellido = apellido;
    }

    /**
     * @return the banco
     */
    public javax.swing.JTextField getBanco() {
        return banco;
    }

    /**
     * @param banco the banco to set
     */
    public void setBanco(javax.swing.JTextField banco) {
        this.banco = banco;
    }

    /**
     * @return the calendario
     */
    public org.freixas.jcalendar.JCalendarCombo getCalendario() {
        return calendario;
    }

    /**
     * @param calendario the calendario to set
     */
    public void setCalendario(org.freixas.jcalendar.JCalendarCombo calendario) {
        this.calendario = calendario;
    }

    /**
     * @return the cancelar
     */
    public javax.swing.JButton getCancelar() {
        return cancelar;
    }

    /**
     * @param cancelar the cancelar to set
     */
    public void setCancelar(javax.swing.JButton cancelar) {
        this.cancelar = cancelar;
    }

    /**
     * @return the categoria
     */
    public javax.swing.JComboBox getCategoria() {
        return categoria;
    }

    /**
     * @param categoria the categoria to set
     */
    public void setCategoria(javax.swing.JComboBox categoria) {
        this.categoria = categoria;
    }

    /**
     * @return the conbConceptos
     */
    public javax.swing.JComboBox getConbConceptos() {
        return conbConceptos;
    }

    /**
     * @param conbConceptos the conbConceptos to set
     */
    public void setConbConceptos(javax.swing.JComboBox conbConceptos) {
        this.conbConceptos = conbConceptos;
    }

    /**
     * @return the conceptos
     */
    public javax.swing.JTabbedPane getConceptos() {
        return conceptos;
    }

    /**
     * @param conceptos the conceptos to set
     */
    public void setConceptos(javax.swing.JTabbedPane conceptos) {
        this.conceptos = conceptos;
    }

    /**
     * @return the cuil
     */
    public javax.swing.JTextField getCuil() {
        return cuil;
    }

    /**
     * @param cuil the cuil to set
     */
    public void setCuil(javax.swing.JTextField cuil) {
        this.cuil = cuil;
    }

    /**
     * @return the cuitEmpresa
     */
    public javax.swing.JTextField getCuitEmpresa() {
        return cuitEmpresa;
    }

    /**
     * @param cuitEmpresa the cuitEmpresa to set
     */
    public void setCuitEmpresa(javax.swing.JTextField cuitEmpresa) {
        this.cuitEmpresa = cuitEmpresa;
    }

    /**
     * @return the datos
     */
    public javax.swing.JTabbedPane getDatos() {
        return datos;
    }

    /**
     * @param datos the datos to set
     */
    public void setDatos(javax.swing.JTabbedPane datos) {
        this.datos = datos;
    }

    /**
     * @return the datosPersonlaes
     */
    public javax.swing.JTabbedPane getDatosPersonlaes() {
        return datosPersonlaes;
    }

    /**
     * @param datosPersonlaes the datosPersonlaes to set
     */
    public void setDatosPersonlaes(javax.swing.JTabbedPane datosPersonlaes) {
        this.datosPersonlaes = datosPersonlaes;
    }

    /**
     * @return the eliminar
     */
    public javax.swing.JButton getEliminar() {
        return eliminar;
    }

    /**
     * @param eliminar the eliminar to set
     */
    public void setEliminar(javax.swing.JButton eliminar) {
        this.eliminar = eliminar;
    }

    /**
     * @return the nombre
     */
    public javax.swing.JTextField getNombre() {
        return nombre;
    }

    /**
     * @param nombre the nombre to set
     */
    public void setNombre(javax.swing.JTextField nombre) {
        this.nombre = nombre;
    }

    /**
     * @return the nroDeCuenta
     */
    public javax.swing.JTextField getNroDeCuenta() {
        return nroDeCuenta;
    }

    /**
     * @param nroDeCuenta the nroDeCuenta to set
     */
    public void setNroDeCuenta(javax.swing.JTextField nroDeCuenta) {
        this.nroDeCuenta = nroDeCuenta;
    }

    /**
     * @return the nroSucursal
     */
    public javax.swing.JTextField getNroSucursal() {
        return nroSucursal;
    }

    /**
     * @param nroSucursal the nroSucursal to set
     */
    public void setNroSucursal(javax.swing.JTextField nroSucursal) {
        this.nroSucursal = nroSucursal;
    }

    /**
     * @return the tablaConceptos
     */
    public javax.swing.JTable getTablaConceptos() {
        return tablaConceptos;
    }

    /**
     * @param tablaConceptos the tablaConceptos to set
     */
    public void setTablaConceptos(javax.swing.JTable tablaConceptos) {
        this.tablaConceptos = tablaConceptos;
    }
    
    
    public void setCategorias(java.util.Vector categorias){
    	CategoriaDTO cat=new CategoriaDTO(); 
    	while (!categorias.isEmpty()){
    		cat=(CategoriaDTO) categorias.get(0);
    		categoria.addItem(cat.getNombre());
    		categorias.remove(0);
    	}
    	
    }
    
    public void setConceptos(java.util.Vector conceptos){
    	ConceptoDTO con=new ConceptoDTO(); 
    	while (!conceptos.isEmpty()){
    		con=(ConceptoDTO) conceptos.get(0);
    		conbConceptos.addItem(con.getDescripcion());  		
    		conceptos.remove(0);
    	}
    	
    }
    
    
    public Vector<ConceptoDTO> eliminarRepetidos(Vector<ConceptoDTO> conceptos){
    	Vector<ConceptoDTO> vector=new Vector<ConceptoDTO>();
    	vector.add((ConceptoDTO) conceptos.get(0));
    	conceptos.remove(0);
    	while (!conceptos.isEmpty()){
    		int i=0;
    
    		while( (i<vector.size())&&(!conceptos.isEmpty())&&(!(vector.get(i).getDescripcion().equals((Object)conceptos.get(0).getDescripcion())))){
    			i++;
    			
    		}
    		if (i>=vector.size()){
    			i--;
    		}
    		if (vector.get(i).getDescripcion().equals((Object)conceptos.get(0).getDescripcion())){
    			
    		}else{
    			vector.add(conceptos.get(0));
    		}
    		conceptos.remove(0);
    	}
    	return vector;    	
    }
    
	
 	public void insertarFila(){
		String[] filavacia=new String[5];
		DefaultTableModel m=(DefaultTableModel)tablaConceptos.getModel();
		m.addRow(filavacia);
		tablaConceptos.setModel(m);

	}
 	
 	
 	public Set getTablaConcep(){
 		int i=0;
 		String descripcion; 
 		Double importe;
 		Double porcentaje;
 		String remunerativo;
 		String tipo;
 		Set<Concepto> vector=new HashSet<Concepto>();
 	    while (i<tablaConceptos.getRowCount()){
 	    	descripcion=(String) tablaConceptos.getValueAt(i,0);
 	    	importe=(Double) tablaConceptos.getValueAt(i, 1);
 	    	porcentaje=(Double) tablaConceptos.getValueAt(i, 2); 
 	    	remunerativo=(String) tablaConceptos.getValueAt(i, 3);
 	    	tipo=(String) tablaConceptos.getValueAt(i, 4);
 	    	Concepto con=new Concepto();
 	    	con.setDescripcion(descripcion);
 	    	con.setImporte(importe);
 	    	con.setPorcentaje(porcentaje);
 	    	con.setRemunerativo(remunerativo);
 	    	con.setTipo(tipo);
 	    	vector.add(con);
 	    	i++;
 	    }
 	    return vector;
 		
 	}
 	
 	public Vector<Concepto> getTablaCon(){
 		int i=0;
 		String descripcion; 
 		Double importe;
 		Double porcentaje;
 		String remunerativo;
 		String tipo;
 		Vector<Concepto> vector = new Vector<Concepto>(); 
 	    while (i<tablaConceptos.getRowCount()){
 	    	descripcion=(String) tablaConceptos.getValueAt(i,0);
 	    	importe=(Double) tablaConceptos.getValueAt(i, 1);
 	    	porcentaje=(Double) tablaConceptos.getValueAt(i, 2); 
 	    	remunerativo=(String) tablaConceptos.getValueAt(i, 3);
 	    	tipo=(String) tablaConceptos.getValueAt(i, 4);
 	    	Concepto con=new Concepto();
 	    	con.setDescripcion(descripcion);
 	    	con.setImporte(importe);
 	    	con.setPorcentaje(porcentaje);
 	    	con.setRemunerativo(remunerativo);
 	    	con.setTipo(tipo);
 	    	vector.add(con);
 	    	i++;
 	    }
 	    return vector;
 		
 	}
 	
 	 public boolean existeConcepto(Vector<Concepto> con, String descripcion){
 		 boolean existe=false;
 		 while ((!con.isEmpty())&&(!(con.get(0).getDescripcion().equalsIgnoreCase(descripcion)))){
 			 con.remove(0);
 		 }
 		 if (con.isEmpty()){
 			 existe=false;
 		 }
 		 else{
 			 existe=true;
 		 }
 		 return existe;
 	 }
 	 
 	public void setTablaConcepto(int fila){
		int i=tablaConceptos.getRowCount()-1;
		while (fila<i){			
			tablaConceptos.setValueAt(tablaConceptos.getValueAt(fila+1,0), fila, 0);
			tablaConceptos.setValueAt(tablaConceptos.getValueAt(fila+1,1), fila, 1);
			tablaConceptos.setValueAt(tablaConceptos.getValueAt(fila+1,2), fila, 2);	
			tablaConceptos.setValueAt(tablaConceptos.getValueAt(fila+1,3), fila, 3);
			tablaConceptos.setValueAt(tablaConceptos.getValueAt(fila+1,4), fila, 4);
			fila++;			
		}
		DefaultTableModel m=(DefaultTableModel)tablaConceptos.getModel();
		m.removeRow(i);
	}
 	
 	// HACER UNA FUNCION QUE SETEE LA TABLA DE LOS CONCEPTOS QUE TIENE UN EMPLEADO PASADO COMO PARAMETRO..
 	//es esta:
 	public void setTablaConceptos(EmpleadoDTO empleado){
 		Set conceptos=empleado.getConceptos();
 		Iterator<Concepto> iter=conceptos.iterator();
 		int i=0;
 		while (iter.hasNext()){
 			Concepto con = iter.next();
 			DefaultTableModel m=(DefaultTableModel)tablaConceptos.getModel();
			String[] filavacia=new String[4];
			m.addRow(filavacia);
 			tablaConceptos.setValueAt(con.getDescripcion(),i,0);
 			tablaConceptos.setValueAt(con.getImporte(),i,1);
 			tablaConceptos.setValueAt(con.getPorcentaje(),i,2);
 			tablaConceptos.setValueAt(con.getRemunerativo(),i,3);
 			tablaConceptos.setValueAt(con.getTipo(),i,4);
 			i++;
 			conceptos.remove(0);
 		}
 	}
 	
 	 public Date getDate() {
         return calendario.getDate();
     } 
 	 
    public void setActionListeners(ActionListener lis) {
        aceptar.addActionListener(lis);
        cancelar.addActionListener(lis);
        categoria.addActionListener(lis);
        agregarConcepto.addActionListener(lis);
        eliminar.addActionListener(lis);
        
    }
}
